<?php echo $this->Session->flash(); ?>
<div id="TB_load"><?php echo $this->Html->image("loading_animation.gif")?></div>
<div class="sale_item">

		<div id=breadcrumbAdmin>
	    	<?php $this->Html->addCrumb('Online Sales', '/Shop/order', array('style'=> ('text-decoration:underline; color:#EB1E70;'))); ?>
	        <?php echo $this->Html->getCrumbs(' > ', array( 'text' => 'Transactions', 'url' => array('controller' => 'sales', 'action' => 'index'), 'escape' => false)); ?>
	    </div>

	    <h2 style="padding:0.5%;"><?php echo __('Online sales'); ?></h2>

	<table class="items">
		<thead>
			<tr>
				<th>Order ID</th>
				<th>Date</th>
				<th>Customer</th>
				<th>NO. of item</th>
				<th>Original Price</th>
				<th>Sale Price</th>
				<th>Sales Receipt</th>
				<th>Refund</th>
				<th>More information</th>
			</tr> 
		</thead>
		<tbody>
		<?php if(!empty($orders)){?>
		<?php foreach($orders as $order){?>
			<tr id="order_id_<?php echo $sale["Order"]["id"]?>">
				<td><?php echo $order["order"]["id"]?></td>
				<td><?php echo $this->Time->format("Y-m-d",$sale["Sale"]["created"])?></td>
				<td><?php echo $sale["Customer"]["first_name"]." ".$sale["Customer"]["last_name"]?></td>
				<td><?php echo count($sale["SaleItem"])?></td>
				<td><?php echo $this->Number->currency($sale["Sale"]["sale_original_price"],"USD")?></td>
				<td><?php echo $this->Number->currency($sale["Sale"]["sale_price"],"USD",array("negative"=>""))?></td>
				<td>
					<a class="btn sale_receipt" href="javascript:;" data-id="<?php echo $sale["Sale"]["id"]?>">Receipt</a>
				</td>
				<td>
				    <a class="btn sale_refund" href="javascript:;" data-id="<?php echo $sale["Sale"]["id"]?>">Refund</a>
				</td>
				<td>
                    <a class="btn sale_view" href="javascript:;" data-id="<?php echo $sale["Sale"]["id"]?>">View more</a>
                </td>
			</tr>
			<?php }}?>
		</tbody>
	</table>

	<div class="paging">
        <?php
        echo $this->Paginator->counter(array(
        'format' => __('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
        ));
        ?>
	<?php
		echo $this->Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));
		echo $this->Paginator->numbers(array('separator' => ''));
		echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));
	?>
	</div>
</div>

</div>
